<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>教师列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/sources/lay/layui/css/layui.css" media="all" />
        <link rel="stylesheet" href="/sources/lay/css/public.css" media="all" />
        <script src="/sources/js/jquery-3.4.1.min.js"></script>
        <script src="/sources/js/xm-select.js" type="text/javascript" charset="utf-8"></script>


    </head>
    <body class="childrenBody">


        <form class="layui-form layui-row layui-col-space10">
            <div class="layui-col-md6 layui-col-xs6">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12 layui-col-xs12">


                        <div class="layui-form-item">
                            <label class="layui-form-label">授课教师</label>
                            <div class="xm-select-demo layui-input-inline teacherlist" name="teacherlist" id="teacherlist" style="width: 400px"></div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">班级名</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input cname" name="cname" lay-verify="required"  autocomplete="off"  placeholder="请输入班级名">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">年级</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input level"  name="level" lay-verify="required" placeholder="请输入年级">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                            <label class="layui-form-label">备注</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input mark"  name="mark" lay-verify="required" placeholder="请输入备注">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">创建时间</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input createtime" name="createtime" id="createtime" lay-verify="required"  placeholder="请选择创建时间" readonly />
                            </div>
                        </div>


                                <input type="hidden" id="id" name="id" class="id">


                        <div class="layui-form-item">
                            <label class="layui-form-label"></label>
                            <div class="layui-input-block">
                                <a class="layui-btn layui-btn-sm" lay-filter="addStudent" lay-submit><i class="layui-icon">&#xe609;</i>提交</a>
                            </div>

                        </div>

                    </div>

                </div>

            </div>


        </form>
        <script type="text/javascript" src="/sources/lay/layui/layui.js"></script>
        <script type="text/javascript" src="/sources/js/classAdd.js"></script>

        <script type="text/javascript">
            function child(arrSelect){
                //加载组件
                layui.config({
                    base: '/sources/js/'
                }).extend({
                    xmSelect: 'xm-select'
                }).use(['xmSelect'], function(){
                    var xmSelect = layui.xmSelect;
                    $.ajax({
                        url:"/teachers/selectall?page=1&limit=100",
                        type:"get",
                        success:function(res){
                            data=res.data
                            arr=[];
                            for(var i in data){
                                arr.push({name: data[i].name, value: data[i].id})
                            }
                            //渲染多选
                            var demo1 = xmSelect.render({
                                el: '#teacherlist',
                                data: arr
                            })
                            if(arrSelect!=null){
                                demo1.setValue(arrSelect)
                            }

                        }
                    })
                })
            }
        </script>
    </body>
</html>
